#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    time_id=startTimer(1000);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::timerEvent(QTimerEvent* ev)
{
    if(ev->timerId()==time_id)
    {
        if(ui->lcdNumber->value()==0)
        {
            killTimer(time_id);
            return;
        }
        ui->lcdNumber->display(ui->lcdNumber->value()-1);
    }
}

